home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 16
/
AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso
/
pd
/
anwendungen
/
amicad
/
arexx_english
/
selectnet.amicad
< prev
next >
Wrap
Text File
|
1998-08-09
|
4KB
|
193 lines
/* $VER: NetList 1.00e (© R.Florac, 09-08-98) */
options results
signal on error
signal on syntax
'FIRSTSEL'; i=result
if result~=0 then do
'NEXTSEL(FIRSTSEL)'
if result~=0 then i=0
end
if i=0 then do
'PICKOBJ("Click on the net to check")'
i=result
end
if i=0 then exit
j=1; nets=0; net.0=""
'TITLE("Reading nets..."):LOCK(-1):OBJECTS(-1)'; objets=result
net.=-1
'TYPE(O='i')'
if result=2 then do
'UNMARK(-1):TEST(O)'
if result=0 then do
'COORDS(O)'
parse var result x0','y0','x1','y1
call test_ligne(x0,y0,objets)
call test_ligne(x1,y1,objets)
end
end
else do
'MESSAGE("Selection incorrect")'
exit
end
'TITLE("Test of junctions...")'
m=1
do while m>0
m=0
i=1
do while i>0
'OO=FINDOBJ('i',7,-1,-1)'; i=result
if i>0 then do
'TEST(OO)'
if result=0 then do
'COL(OO)'; x0=result
'LINE(OO)'; y0=result
n=test_jonction(x0,y0,objets)
if n=1 then do
'MARK(OO)'
call marquer_ligne(x0,y0,objets)
m=1
end
end
if i=objets then i=0
else i=i+1
end
end
end
'TITLE("Checking grounds...")'
label=""
do i=1 to objets
'O=FINDPART('i',"GROUND")'; i=result
if i>0 then do
j=connexion_broche(i,1)
if j>0 then do
'TEST('j')'
if result=1 then do
label=0
leave i
end
end
i=i+1
end
else leave
end
if label="" then do
'TITLE("Looking for labels...")'
do i=1 to objets
'TYPE(O='i')'
if result=4 | result=12 | result=11 then do
'ABS(FINDLINE(1,COL(O),LINE(O)))'; j=result
if j>0 then do
'TEST('j')'
if result=1 then do
'READTEXT(O)'; label=result; leave i
end
end
end
end
end
if label="" then do
'TITLE("Looking for powers...")'
do i=1 to objets
'O=FINDPART('i',"POWER SUPPLY")'; i=result
if i>0 then do
j=connexion_broche(i,1)
if j>0 then do
'TEST('j')'
if result=1 then do
'READTEXT(GETVAL(O))'; label=result; leave i
end
end
i=i+1
end
else leave
end
end
'TITLE("")'
if label~="" then 'MESSAGE("Net 'label'")'
exit
test_ligne: procedure expose net.
parse arg x0,y0,objets
o=1
do until o=0
'X=FINDOBJ('o',2,'x0','y0')'; o=result
if o>0 then do
'IF(TEST(X),0,MARK(X):COORDS(X))'
if result~=0 then do
net.o=1
parse var result x1','y1','x2','y2
if x0=x1 & y0=y1 then call test_ligne(x2,y2,objets)
else call test_ligne(x1,y1,objets)
end
if o=objets then return
o=o+1
end
end
return
marquer_ligne: procedure expose net.
parse arg x0,y0,objets
o=1
do until o=0
'X=ABS(FINDLINE('o','x0','y0'))'; o=result
if o>0 then do
'IF(TEST(X),0,MARK(X):COORDS(X))'
if result~=0 then do
net.o=1
parse var result xl','yl','x1','y1
call test_ligne(xl,yl,objets)
call test_ligne(x1,y1,objets)
end
if o=objets then return
o=o+1
end
end
return
test_jonction: procedure expose net.
parse arg xj,yj,objets
obj=1
do while obj>0
'X=ABS(FINDLINE('obj','xj','yj'))'; obj=result
if net.obj=1 then return 1
if obj=0 then return 0
if obj=objets then return 0
obj=obj+1
end
return 0
connexion_broche: procedure
parse arg objet,broche
'PINCOL(O='objet',B='broche')'; xj=result
'PINLINE(O,B)'; yj=result
'FINDOBJ(1,2,'xj','yj')'; xl=result
if xl>0 then return xl
'FINDLINE(1,'xj','yj')'; xl=result
if xl<=0 then return 0
'FINDOBJ(1,7,'xj','yj')'
if result>0 then return xl
return 0
syntax:
erreur=RC
'MESSAGE("Script SelectNet.AmiCAD:"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
exit
error:
'MESSAGE("Script SelectNet.AmiCAD:"+CHR(10)+"Erreur in line 'SIGL'")'
exit